﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _3._5._1_ref参数_class_A
{
    internal class Program
    {
        static void Main(string[] args)
        {
            A a = new A { X = 1 };
            ChangerefA(ref a);
            Console.WriteLine($"ref:a1.X:{a.X}");

            ChangeA( a);
            Console.WriteLine($"a1.X:{a.X}");
            Console.ReadKey();
        }


        public static void ChangerefA(ref A a)
        {
            a.X = 2;
            a = new A { X = 3 };
        }
        public static void ChangeA( A a)
        {
            a.X = 2;
            a = new A { X = 3 };
        }

        public class A
        {
            public int X { get; set; }
        }

    }
}
